<template>
	<div>
		<!-- 内容 -->
		<transition name="fade" mode="out-in" appear>
			<el-row>
				<el-col :span="8">
					<el-card class="box-card">
						<div slot="header" class="clearfix">
							<span>服务基本信息</span>
						</div>
						<div v-for="item in formLeftText" :key="item.text" class="text item">
							<p v-if="item.field=='logo'">
								{{item.text}}：<img :src="formLeftData[item.field]" style="width: 21px; height: 21px;" />
							</p>
							<p v-else>
								{{item.text}}：{{formLeftData[item.field]}}
							</p>
						</div>
						<div class="" v-if="formLeftData.status==1">
							<el-button type="primary" @click="goService()">查看服务</el-button>
							<el-button type="primary" @click="goIntegration()">查看积分</el-button>
						</div>
						<div class="" v-if="formLeftData.status==2">
							<el-button type="primary" @click="shenHe(1)">通过</el-button>
							<el-button type="primary" @click="shenHe(3)">驳回</el-button>
						</div>
					</el-card>
				</el-col>
				<el-col :span="8">
					<el-card class="box-card">
						<div slot="header" class="clearfix">
							<span>相关证件</span>
						</div>
						<div v-for="(item, index) in formCenterText" :key="index" class="text item">
							<p>{{item.title}}</p>
							<el-col :span="12">
								<img :src="formLeftData[item.field[0]]" />
							</el-col>
							<el-col :span="12" v-if='item.field[1]'>
								<img :src="formLeftData[item.field[1]]" />
							</el-col>
						</div>
					</el-card>
				</el-col>

			</el-row>
		</transition>
	</div>
</template>

<script>
	import http from 'assets/js/http.js'

	export default {
		components: {},
		data() {
			return {
				id: '',
				formLeftData: {},
				formLeftText: [{
						text: '服务种类',
						field: 'title',
					},
					{
						text: '服务名称',
						field: 'name',
					},
					{
						text: '价格',
						field: 'name',
					},
					{
						text: '服务介绍',
						field: 'presentation',
					},
					{
						text: '购买须知',
						field: 'notice',
					},
					{
						text: '优惠券使用',
						field: 'discounts_is',
					},
					{
						text: '赠送积分',
						field: 'integral',
					},
					{
						text: '会员优惠',
						field: 'class_type',
					},
					{
						text: '担保',
						field: 'if_guarantee',
					},
					{
						text: '发布日期',
						field: 'add_time',
					},
					{
						text: '审核状态',
						field: 'status',
					},
					{
						text: '审核通过日期',
						field: 'company_sort_name',
					},
					{
						text: '总成交量',
						field: 'num',
					},
					{
						text: '总订单数',
						field: 'total_num',
					},
					{
						text: '总浏览量',
						field: 'view_num',
					},

				],
				formCenterText: [{
						title: '身份证附件',
						field: ['identity_img_front', 'identity_img_contrary']
					},
					{
						title: '营业执照附件',
						field: ['permit']
					},

				],
			}
		},
		created() {
			this.id = this.$route.params.id
			const data = {
				'goods_id': this.id
			}
			this.$watch('$route', {
				deep: true,
				handler: function() {
					this.id = this.$route.params.id
					this.apiPost('/AdminApi/shop/goods_deta', data).then(res => {
						this.handelResponse(res, data => {
							this.formLeftData = data

						})
					})
				}
			})
			this.apiPost('/AdminApi/shop/goods_deta', data).then(res => {
				this.handelResponse(res, data => {
					this.formLeftData = data

				})
			})

		},
		methods: {
			goService: function() {
				this.$router.push({
					name: '单商户服务列表',
					query: {
						id: this.id
					}
				})
			}
		},
		mixins: [http]
	}
</script>

<style scoped>
	table {
		border-collapse: collapse;
		/*关键代码*/
	}
</style>